<include file="Public:header" />
<script>
$(document).ready(function(e) {
    $('.showcurimg').each(function(index, element) {
        $(this).click(function(e) {
            $(this).find('img').show();
        });
		$(this).mouseleave(function(e) {
            $(this).find('img').hide();
        });
    });
});



function selectCategory(id){
	$.ajax({
		url:"{:U('selectCategory')}",
		data:"id="+id+"&modules_id={$modules_id}",
		dataType:"json",
		type:'POST',
		success: function(data){
			if(data.status == 1){
				if(data.type==1){
					$('#title'+id).addClass('selectednews');
					$(window.parent.document).find('#CategoryList_').append('<li sortkey="0" id="news0_'+id+'" style="text-align:left;">[<a href="javascript:void(0);" onclick="sortListInfo(\'up\',this)">上</a> <a href="javascript:void(0);" onclick="sortListInfo(\'down\',this)">下</a>] '+$('#title'+id).html()+'<a href="javascript:;" onClick="removeListInfoCate('+id+',0);" style="font-size:20px; height:24px; width:24px; line-height:24px; text-align:center; display:inline-block; color:#fff; background:#f00; border-radius:20px;">×</a></li>');
				}else{
					$('#title'+id).removeClass('selectednews');
					$(window.parent.document).find('#CategoryList_ #news0_'+id).remove();
				}
			}else{
				alert(data.info);
			}
		}
	});
}
</script>	
<style> 
.header{display:none;}
	.w790{margin-top:0px;}
	.selectednews{color:#0F0; font-weight:bold;}
</style>
<div class="container main"> <include file="Public:left" />
  <div class="w790">
    <div class="h"><a href="{:U('add')}" class="btn btn-info"><i class="glyphicon glyphicon-plus"></i>新增栏目</a> <a href="{:U('Product_category/selectCategory',array('modules_id' => $modules_id))}" class="btn btn-info"><i class="glyphicon glyphicon-plus"></i>商城分类</a>
      <form action="{:U('index')}" method="get" class="fr form-inline">
      <label class="checkbox-inline"><input name="status" type="checkbox" <eq name="status" value="1">checked="ckecked"</eq> value="1" />状态</label>
      <label class="checkbox-inline"><input name="is_hot" type="checkbox" <eq name="is_hot" value="1">checked="ckecked"</eq> value="1" />热门</label>
      <label class="checkbox-inline"><input name="is_rec" type="checkbox" <eq name="is_rec" value="1">checked="ckecked"</eq> value="1" />推荐</label>
      <label class="checkbox-inline"><input name="is_top" type="checkbox" <eq name="is_top" value="1">checked="ckecked"</eq> value="1" />置顶</label>
      
      
      
        <input type="hidden" name="pagesize" value="{$pagesize}" />
        <input type="text" name="keywords" placeholder="输入搜索关键词" class="form-control" value="{$keywords}" />
        <button type="submit" class="btn btn-default">搜索</button>
      </form></div>
    <div class="table_">
      <table class="table table-bordered" width="100%" border="0" cellspacing="0" cellpadding="0">
        <thead>
          <tr>
            
            <td align="center">标题</td>
            
            <td align="center">所属分类</td>
            <td align="center">状态</td>
           
          </tr>
        </thead>
        <volist name="list" id="vo">
          <tr class="data_list">
            
            <td><a href="javascript:;" id="title{$vo.id}" class="<if condition="in_array($vo['id'],$selectedid)">selectednews</if>" onclick="selectCategory({$vo.id});">{$vo.title}</a><notempty name="vo['img_url']">(<a class="showcurimg" href="#">图<img src="{:getThumbPath($vo['img_url'])}" style="width:100px; position:absolute; margin-top:0px; display:none;" /></a>)</notempty></td>
            
            <td align="center">{$vo.category_name}</td>
            <td align="center"><eq name="vo['status']" value="1"><span class="status1 status_btn" field="status,{$vo.id}"></span>
                <else/>
                <span class="status0 status_btn" field="status,{$vo.id}"></span></eq></td>
            
          </tr>
          
          
          <volist name="vo['sub']" id="svo">
          
          <tr class="data_list">
            
            <td><a href="javascript:;" id="title{$svo.id}" class="<if condition="in_array($svo['id'],$selectedid)">selectednews</if>" onclick="selectCategory({$svo.id});">{$svo.title}</a><notempty name="vo['img_url']">(<a class="showcurimg" href="#">图<img src="{:getThumbPath($svo['img_url'])}" style="width:100px; position:absolute; margin-top:0px; display:none;" /></a>)</notempty></td>
           
            <td align="center">{$svo.category_name}</td>
            <td align="center"><eq name="vo['status']" value="1"><span class="status1 status_btn" field="status,{$svo.id}"></span>
                <else/>
                <span class="status0 status_btn" field="status,{$svo.id}"></span></eq></td>
            
          </tr>
          
          </volist>
          
          
          
        </volist>
      </table>
      <div class="pages">
        
        <form class="fr" style="display:inline;" id="pagesize" action="" method="get">
          每页
          <select name="pagesize" onchange="document.getElementById('pagesize').submit();">
            <option 
            <eq name="pagesize" value="10">selected="selected"</eq>
             value="10">10
            </option>
            <option 
            <eq name="pagesize" value="20">selected="selected"</eq>
             value="20">20
            </option>
            <option 
            <eq name="pagesize" value="30">selected="selected"</eq>
             value="30">30
            </option>
            <option 
            <eq name="pagesize" value="50">selected="selected"</eq>
             value="50">50
            </option>
            <option 
            <eq name="pagesize" value="100">selected="selected"</eq>
             value="100">100
            </option>
            <option 
            <eq name="pagesize" value="500">selected="selected"</eq>
             value="500">500
            </option>
          </select>
          条
          <input type="hidden" name="modules_id" value="{$modules_id}" />
          <input type="hidden" name="category_id" value="{$category_id}" />
          <input type="hidden" name="keywords" value="{$keywords}" />
        </form>
        <div class="fr">{$pages}</div>
      </div>
    </div>
  </div>
  <div class="clear"></div>
</div>
<include file="Public:footer" />